﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace PDX
{
    /// <summary>
    /// A standard model for a bindable property, meant to facilitate
    /// easier data binding and conventional DataTemplates.
    /// </summary>
    /// <remarks>
    /// The PropertyModel is an object that sits between a UI element
    /// and a property on a viewmodel. By providing a standard model for
    /// properties, we can do some interesting things. For example, the
    /// <see cref="DefaultPropertyModel{T}"/> exposes the property's value
    /// via a property called "Value", regardless of what the property is
    /// named. So instead of binding to the viewmodel's "FirstName" property,
    /// you can bind to the property model's "Value" property. This makes
    /// conventional DataTemplates possible, an important part of PDX.
    /// Furthermore, since bindings are being routed through the PropertyModel,
    /// we can implement our own notification mechanism, making INotifyPropertyChanged
    /// unnecessary in many situations.
    /// </remarks>
    public interface IPropertyModel : INotifyPropertyChanged
    {
        object Value { get; set; }

        bool IsReadonly { get; }

        Type PropertyType { get; }

        /// <summary>
        /// A dictionary that allows the attaching of various bindable aspects.
        /// </summary>
        /// <remarks>
        /// For example, by default the validation model is placed here with
        /// the key "Validation". Meaning you can bind to "Ext[Validation].Message"
        /// to get the validation message, if any, for this property model.
        /// </remarks>
        PropertyModelAspectCollection Ext { get; }

        /// <summary>
        /// Gets the display name.
        /// </summary>
        string DisplayName { get; }
    }
}
